package _struct

import (
	"encoding/json"
	"fmt"
)

//字段名小写是不会参与json序列化
type Books struct {
	Title   string `json:"title"`
	Author  string `json:"author"`
	BookId  int    `json:"book_id"`
	Subject string `json:"subject"`
}

func TestStruct() {
	var book Books
	book.Title = "go programing"
	fmt.Println(book)
	var book2 = Books{Title: "golang", Author: "bruce", BookId: 123}
	marshal, err := json.Marshal(book2)
	if err != nil {
		fmt.Println(err)
	}
	fmt.Println(string(marshal))

}
